package cn.edu.scau.cmi.limingben.singleton;

import javafx.scene.control.Alert;
import javafx.scene.control.Alert.AlertType;

public class Chairman {
	
	private static Chairman chairman= null;
	private String name = null;
	
	private Chairman (String name) {
		this.name = name;
	}
	
	public static Chairman getInstance(String name) {
		if(chairman==null) {
			if(name.equals("毛泽东"))
			chairman = new Chairman(name);
			else {
				Alert alert = new Alert(AlertType.INFORMATION);
				alert.setContentText("毛泽东");
				alert.setHeaderText("提醒");
				alert.showAndWait();
			}
			return chairman ;
		}else {
			return chairman;
		}
	}

	public Chairman getChairman() {
		return chairman;
	}

	public String getName() {
		return name;
	}
	
	public static boolean judge(Chairman ch) {
		if(ch==chairman) {
			return true;
		}
		return false;
	}

}
